<?php
defined('IN_ADMIN') or exit('No permission resources.');
include $this->admin_tpl('header','Admin');
?>
<div class="pad_10">
<div class="common-form">
<form name="myform" action="?m=Document&c=Platform&a=add" method="post" id="myform">
<table width="100%" class="table_form contentWrap" align="center">
	<tr>
		<td width="80"><?php echo L('platformname')?></td> 
		<td>	
			<input type="text" name="info[name]" value="<?php echo $info[name]?>" id="name" class="input-text"></input>
			<input type="button" id="platformname_prompt" value="<?php echo L('platformname_prompt') ?> " style="border: 0px; background:none">				
		</td>
	</tr>
	<tr>
		<td><?php echo L('identifier')?></td> 
		<td>
			<input type="text" name="info[identifier]" value="<?php echo $info[name]?>"></input>
			<?php echo L('identifier_name') ?>

		</td>
	</tr>
	<tr>
		<td><?php echo L('desc')?></td> 
		<td>
			<input type="text" name="info[listorder]"></input>
			<?php echo L('desc_name') ?>
		</td>
	</tr>

	
	<tr>
		<td><?php echo L('platform_url')?></td> 
		<td>
			<input type="text" name="info[url]" style="width:50%">
			<?php echo L('url_name') ?>
		</td>
	</tr>
	<tr>
		<td><?php echo L('intro')?></td> 
		<td>
			<textarea name="info[desc]"></textarea>
		</td>
	</tr>
</table>

    <div class="bk15"></div>
    <input name="dosubmit" type="submit" value="<?php echo L('submit')?>" class="dialog" id="dosubmit">
</form>
</div>
</div>
</body>
</html>
<script type="text/javascript">
$("#name").blur(function(){
	var name = $("#name").val();
	if(name){
		$.ajax({
			type: "POST",
			url: "<?php echo U('Document/Platform/confirmation') ?>",
			dataType: "json",
			data : {"name":name},
			success: function(strJson){
				if(strJson == '1'){
					$('#platformname_prompt').val('输入正确');
					$('#dosubmit').removeAttr("disabled");
				}else{
					$('#platformname_prompt').val('此名称已被占用');
					$('#dosubmit').attr('disabled','true');
				}
			}
		});
	}else{
		$('#platformname_prompt').val('请输入平台名称');
		$('#dosubmit').attr('disabled','true');
	}	
	
});
</script>